blob: cf35530d1dfc381ae3f3a4c28fc4ff752256ae6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
import { Suspense } from "react"
import { Shell } from "@/components/shell"
import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"
import { getContactPossibleItems } from "@/lib/contact-possible-items/service"
import { searchParamsCache } from "@/lib/contact-possible-items/validations"
import { ContactPossibleItemsTable } from "@/lib/contact-possible-items/table/contact-possible-items-table"
import { getValidFilters } from "@/lib/data-table"
import { type SearchParams } from "@/types/table"
interface ContactPossibleItemsPageProps {
searchParams: Promise<SearchParams>
}
export default async function ContactPossibleItemsPage({
searchParams,
}: ContactPossibleItemsPageProps) {
// ✅ searchParams 파싱
const resolvedSearchParams = await searchParams
const search = searchParamsCache.parse(resolvedSearchParams)
console.log("Parsed search params:", search)
const validFilters = getValidFilters(search.filters)
// ✅ 모든 데이터를 병렬로 로드
const promises = Promise.all([
getContactPossibleItems({
...search,
filters: validFilters,
}),
])
return (
<Shell className="gap-4">
{/* ═══════════════════════════════════════════════════════════════ */}
{/* 페이지 헤더 */}
{/* ═══════════════════════════════════════════════════════════════ */}
<div className="flex items-center justify-between space-y-2">
<div className="flex items-center justify-between space-y-2">
<div>
<h2 className="text-2xl font-bold tracking-tight">
담당자별 자재 관리
</h2>
<p className="text-muted-foreground">
기술영업 담당자별 자재를 관리합니다.
</p>
</div>
</div>
</div>
{/* ═══════════════════════════════════════════════════════════════ */}
{/* 메인 테이블 */}
{/* ═══════════════════════════════════════════════════════════════ */}
<Suspense
fallback={
<DataTableSkeleton
columnCount={12}
searchableColumnCount={2}
filterableColumnCount={3}
cellWidths={["10rem", "10rem", "12rem", "8rem", "8rem"]}
shrinkZero
/>
}
>
<ContactPossibleItemsTable promises={promises} />
</Suspense>
</Shell>
)
}
|